﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for CategoryDL
/// </summary>
internal class CategoryDL
{
    internal static object GetMainCategories()
    {
        return OnlineTestHelper.Context.SP_GET_CATEGORIES();
    }

    internal static object GetSubCategories(string categoryId)
    {
        return OnlineTestHelper.Context.SP_GET_SUB_CATEGORIES(categoryId);
    }

    internal static bool Insert(CategoryBL categoryBL)
    {
        return OnlineTestHelper.Context.SP_INSERT_CATEGORY(categoryBL.CategoryName, categoryBL.ParentCategoryId, categoryBL.UserId) == 0 ? true : false;
    }

    internal static bool Update(CategoryBL categoryBL)
    {
        return OnlineTestHelper.Context.SP_UPDATE_CATEGORY(categoryBL.CategoryId, categoryBL.CategoryName, categoryBL.ParentCategoryId, categoryBL.UserId) == 0 ? true : false;
    }

    internal static bool Delete(CategoryBL categoryBL)
    {
        return OnlineTestHelper.Context.SP_DELETE_CATEGORY(categoryBL.CategoryId) == 0 ? true : false;
    }
}